ARRAY O ELECTION (array1; field1; arrayN; fieldN)
                                                                                    Pg 13-12

array       Array          Array to copy to the selection
field    
   Field             Field to receive the array data

Copies one or more arrays into a selection of records based on the order of the array elements and the records. All fields must be from the same file. If there are more elements than records, new records are created.

ARRAY TO SELECTION copies one or more arrays into a selection of records. All fields listed must belong to the same file.
ARRAY TO SELECTION generates an error if the command cannot be executed.

If a selection already exists, the elements of the arrays are put into the records, based on the order of the array and the order of the records. If there are more elements than there are records, then new records are created. The records, whether they are new or existing ones, are automatically saved.

If the arrys are different sizes, the first array is used to determine how many elements to copy. Any additional arrays are also moved into the field that follows each array name.

This command is the complement of SELECTION O RRAY. The ARRAY TO SELECTION command does not allow fields from related files even when an automatic relation exists. The command modifies the current selection and the current record.

When the ARRAY TO SELECTION command is executed, the LockedSet variable can be tested to determine whether certain records are locked or not.

WARNING:  ARRAY TO SELECTION overwrites information in existing records, and so should be used with caution.

4D SERVER: The command is optimised for the 4D Server. The command is executed on the server. If any records are locked they will not be replaced.

In the following example, the two arrays F and C put data into the [People] file. The F array is put in the First field, and the C array is put in the Company field.

      ARRAY TO SELECTION(F;[People]First;C;[People]Company)

See also: ARRAY O IST, SELECTION O RRAY